#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# ======================================================
# @File:      : test11
# @Author     : forward_huan
# @Date       : 2024/11/16 17:54
# @Desc       :
# ======================================================
from typing import List


class Solution:
    def maxArea(self, height: List[int]) -> int:
        max_value, max_width = 0, len(height) - 1
        left, right = 0, max_width
        while left < right:
            l_height, r_height = height[left], height[right]
            if l_height < r_height:
                max_value = max(max_value, l_height * (right - left))
                left += 1
            else:
                max_value = max(max_value, r_height * (right - left))
                right -= 1
        return max_value


print(Solution().maxArea(height=[1, 8, 6, 2, 5, 4, 8, 3, 7]))
print(Solution().maxArea(height=[1, 1]))
print(Solution().maxArea(height=[8, 7, 2, 1]))
